package com.leyou.search.config;

import com.leyou.search.interceptor.AppTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @date: 2021/4/12 0012 17:58
 * @description: 配置拦截器
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Autowired
    private AppTokenInterceptor appTokenInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /**
         * 注册拦截器
         * addPathPatterns(): 添加拦截路径。默认就是拦截全部路径  /**
         * excludePathPatterns(): 添加放行路径。
         */
        registry.addInterceptor(appTokenInterceptor);

    }
}
